package org.odst;

import java.util.List;
import java.util.Map;

import org.odst.controller.WorkbookCellFinderImpl;


/**
 * @author Leonid Vysochyn
 */
public class MockWorkbookCellFinder extends WorkbookCellFinderImpl {
    Map<String, Map<String, List<String>>> sheetCellsMapping;

    public MockWorkbookCellFinder(Map<String, Map<String, List<String>>> sheetCellsMapping) {
        this.sheetCellsMapping = sheetCellsMapping;
    }


    public List<String> findCell(String sheetName, String cellName) {
        if (!sheetCellsMapping.containsKey(sheetName)) {
            throw new IllegalArgumentException("Can't find sheet with name " + sheetName);
        }
        Map<String, List<String>> cellsMapping = sheetCellsMapping.get(sheetName);
        return cellsMapping.get(cellName);
    }

    public List<String> findCell(String sheetName, int rowNum, int colNum) {
        org.odst.parser.CellReference cellReference = new org.odst.parser.CellReference(rowNum, colNum, false, false);
        return findCell(sheetName, cellReference.formatAsString());
    }
}
